# -----------------------------------------------
# Author: yuz
# Copyright: 湖南零檬信息技术有限公司
# Email: wagyu2016@163.com
# Phone&Wechat: 18173179913
# Site: http://www.lemonban.com
# Forum: http://testingpai.com
# -----------------------------------------------
import requests


def login():
    url = 'http://api.lemonban.com/futureloan/member/login'
    headers = {
        "X-Lemonban-Media-Type": "lemonban.v2"
    }
    data = {
        "mobile_phone": "18111112222",
        "pwd": "12345678"
    }
    r = requests.post(url, json=data, headers=headers)
    content = r.json()

    member_id = content['data']['id']
    token_type = content['data']['token_info']['token_type']
    token = content['data']['token_info']['token']

    url = f'http://api.lemonban.com/futureloan/member/{member_id}/info'
    headers = {
        'Authorization': token_type + ' ' + token,
        "X-Lemonban-Media-Type": "lemonban.v2"
    }
    r = requests.get(url, headers=headers)
    print(r.text)